/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test;

import autoancillary.Categories;
import autoancillary.HibernateUtil;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author USER
 */
public class CategoriesHelper {
    Session session = null;

    public CategoriesHelper() {
        session = HibernateUtil.getSessionFactory().getCurrentSession();
    }
    
    public List<Categories> getCategories(){
        Query q = session.createQuery("from Categories");
        List<Categories> list = null;
        Transaction tx = session.beginTransaction();
        list = q.list();
        return list;
    }
}
